/*
 * @Author: llch
 * @Date: 2020-09-16 15:35:47
 * @LastEditTime: 2020-09-17 11:47:15
 * @LastEditors: Please set LastEditors
 * @Description: 已完成关卡入口
 * @FilePath: \tower_defense_demo\assets\scripts\roadmap_scene\level_entry_info.ts
 */

const {ccclass, property} = cc._decorator;

@ccclass
export default class LevelEntryInfo extends cc.Component {

    @property(cc.Node)
    public star_node_arr: Array<cc.Node> = [];

    onLoad() {
        // this.show_level_star_info(0);
    }

    // 显示已完成关卡的星星数
    public show_level_star_info(star_num: number): void {
        if (star_num < 0 || star_num > 3) {
            return;
        }

        // 有几颗星就显示
        for (let i = 0; i < this.star_node_arr.length; i++) {
            if (i <= star_num - 1) {
                this.star_node_arr[i].active = true;
            } else {
                this.star_node_arr[i].active = false;
            }
        }
    }
}
